Skip to content

Share reflected method parameter compilation - #2689

Open
Morriar wants to merge 1 commit into
mainfrom
at/share-method-parameter-compilation
Open

Share reflected method parameter compilation#2689
Morriar wants to merge 1 commit into
mainfrom
at/share-method-parameter-compilation

Conversation

@Morriar

@Morriar Morriar commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Centralize reflected parameter name sanitization and RBI::Param construction in RBIHelper and reuse the helper from DSL and gem method compilation.

Use RBI 0.4.3 to preserve reflected **nil parameters as RBI::NoKwParam, with regression coverage.

@Morriar
Morriar requested a review from a team as a code owner July 30, 2026 21:25
@Morriar Morriar added the chore label Jul 30, 2026
when :block
RBI::BlockParam.new(name)
else
Kernel.raise "Unknown type `#{type}`."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL, agent found that :nokey is a valid parameter kind for: def foo(*args, **nil). Apparently it's used to reject kwargs. It's not supported in rbi but Sorbet doesn't support it either so not raising might be enough.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will also be a :noblock version of it in Ruby 4.1: ruby/ruby@9967418

def foo(*args, &nil) = 42

method(:foo).parameters # => [[:rest, :args], [:noblock]]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added support to rbi: Shopify/rbi#639

@paracycle paracycle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactor, thank you!

Comment thread lib/tapioca/helpers/rbi_helper.rb Outdated
@Morriar
Morriar force-pushed the at/share-method-parameter-compilation branch 2 times, most recently from 25c9f58 to 935c111 Compare August 6, 2026 15:46
@Morriar
Morriar force-pushed the at/share-method-parameter-compilation branch from 935c111 to e402855 Compare August 6, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants